"""
    将数据从txt文件提取出来，放到excel表中
"""
import openpyxl

file = open(r"C:\Users\suyujie\Desktop\测试数据\接口测试用例数据\投资期限理财产品接口测试用例.txt",'r',encoding='utf-8')
data = file.readlines()
workbook = openpyxl.load_workbook(r"C:\Users\suyujie\Desktop\测试数据.xlsx")
sheeet = workbook['期限理财']
ch,us,pa,co=1,2,3,4
for i in range(2,len(data)+2):
    list = data[i-2].split(';')
    sheeet.cell(i,ch).value = list[0]#产品id
    sheeet.cell(i,us).value = list[1]#用户id
    sheeet.cell(i,pa).value = list[2]#密码
    sheeet.cell(i,co).value = list[3]#预期响应码
    # print(list)
workbook.save(r"C:\Users\suyujie\Desktop\测试数据.xlsx")
file.close()
workbook.close()